<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app"></div>
    <script src="../vuejs/vue.js"></script>
    <template id="my-app">
        <ul>
            <li v-for="item in letters" :key="item">{{item}}</li>
        </ul>
        <button @click="insertF">插入f</button>
    </template>
    <script>
        Vue.createApp({
            template: `#my-app`,
            data() {
                return {
                    letters: ['a', 'b', 'c', 'd']
                }
            },
            methods: {
                insertF() {
                    this.letters.splice(2, 0, 'f')
                }
            }

        }).mount('#app')
    </script>
</body>

</html>